﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace vroom.wcf.service.config
{
	public class CacheConfigSection : ConfigurationSection
	{
		[ConfigurationProperty("cacheOnStart", DefaultValue = false, IsRequired = true)]
		public bool CacheOnStart
		{
			get { return (bool) this["cacheOnStart"]; }
			set { this["cacheOnStart"] = value; }
		}


		[ConfigurationProperty("tablesToCache", DefaultValue = "", IsRequired = true)]
		public string TablesToCache
		{
			get { return (string) this["tablesToCache"]; }
			set { this["tablesToCache"] = value; }
		}


		[ConfigurationProperty("daysToLoadPriorToToday", DefaultValue = 0, IsRequired = true)]
		public int DaysToLoadPriorToToday
		{
			get { return (int)this["daysToLoadPriorToToday"]; }
			set { this["daysToLoadPriorToToday"] = value; }
		}


		[ConfigurationProperty("cacheManagerUpdateDurationInMinutes", DefaultValue = 5, IsRequired = true)]
		public int CacheManagerUpdateDurationInMinutes
		{
			get { return (int)this["cacheManagerUpdateDurationInMinutes"]; }
			set { this["cacheManagerUpdateDurationInMinutes"] = value; }
		}


		[ConfigurationProperty("evictFromCacheDurationInHours", DefaultValue = 20.0, IsRequired = true)]
		public double EvictFromCacheDurationInHours
		{
			get { return (double)this["evictFromCacheDurationInHours"]; }
			set { this["evictFromCacheDurationInHours"] = value; }
		}


		[ConfigurationProperty("waitOnObjectsToPopulate", DefaultValue = true, IsRequired = true)]
		public bool WaitOnObjectsToPopulate
		{
			get { return (bool)this["waitOnObjectsToPopulate"]; }
			set { this["waitOnObjectsToPopulate"] = value; }
		}


		[ConfigurationProperty("maxWaitForObjectToPopulateDurationInSeconds", DefaultValue = 300, IsRequired = true)]
		public int MaxWaitForObjectToPopulateDurationInSeconds
		{
			get { return (int)this["maxWaitForObjectToPopulateDurationInSeconds"]; }
			set { this["maxWaitForObjectToPopulateDurationInSeconds"] = value; }
		}


		[ConfigurationProperty("waitOnObjectCacheDurationInSeconds", DefaultValue = 20, IsRequired = true)]
		public int WaitOnObjectCacheDurationInSeconds
		{
			get { return (int)this["waitOnObjectCacheDurationInSeconds"]; }
			set { this["waitOnObjectCacheDurationInSeconds"] = value; }
		}

	}
}
